package com.xy.consumer.server;

import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.List;
@Component
public class DeptClientFallbackFactoryImpl implements FallbackFactory<DeptClientService> {
    @Override
    public DeptClientService create(Throwable throwable) {
        return new DeptClientService() {
            @Override
            public String getDept(Integer id) {
                return "此服务提供者已停止服务Consumer";
            }

            @Override
            public List<String> getDeptList() {
                // 返回空
                return Arrays.asList("1","2","3");
            }
        };
    }
}
